This pertains to the field of computers. In particular, this pertains to methods and apparatus for computing reciprocals and performing divide operations.
Computers are well known for their ability to perform mathematical functions at a high rate of speed. In order to achieve such speed, computers use various techniques to perform mathematical functions on given operands. Limitations in the representation of numbers and in numerical calculations within the computer lead to computed results that are only accurate to within some known or estimated error term. The ability to perform basic functions such as addition, subtraction, multiplication, and division to a consistent accuracy in a timely manner is a consideration in computational performance of the computer system.
One technique for implementing a mathematical function is to implement the function hardware. Math functions including addition and subtraction might be accomplished by performing the steps of 1) loading registers with the operands; 2) executing the operational code (xe2x80x9copcodexe2x80x9d) for the desired function; and then, 3) retrieving the result from one or more registers. The opcode is simply a command to perform the function implemented in hardware.
One disadvantage of this prior art technique is that some functions, such as division, typically require several cycles for completion which in turn tends to adversely affect system performance.
An alternative method of computing other results, such as reciprocals       (                  i        .        e        .            ,                        f          ⁡                      (            x            )                          =                  1          x                      )    ,
often involves looking the result up in a table. For example, the steps for computing a reciprocal might include 1) scaling or normalizing an operand; 2) looking up a reciprocal value corresponding to the normalized value in a lookup xe2x80x9cseedxe2x80x9d table; and 3) scaling or denormalizing the looked up value to reflect the reciprocal of the denormalized operand. The lookup table is typically stored in a read only memory (ROM). The error associated with this technique is controlled to a great extent by the xe2x80x9cheightxe2x80x9d and xe2x80x9cwidthxe2x80x9d or the precision of the entry in the lookup table.
One disadvantage of the conventional lookup approach is that the area required to store the lookup table on the integrated circuit may prevent the lookup approach from being a cost effective technique for given precision requirements.
A cost effective way of implementing mathematical functions such as reciprocal or division to within a consistent error margin in a give time frame is a desirable feature of a computer system.
Methods and apparatus for computing reciprocals and performing divide operations in a computer are described.
A reciprocal of an operand is determined by looking up an estimated reciprocal term in a first lookup table stored in a first computer memory wherein the estimated reciprocal term corresponds to at least a portion of the operand. An error term is looked up in a second lookup table stored in a second computer memory. The error term corresponds to at least a portion of the operand. The reciprocal is generated from the estimated reciprocal term and the error term.
A method of performing a divide operation in a computer includes the step of looking up an estimated reciprocal term in a first lookup table stored in a first computer memory. The estimated reciprocal term corresponds to at least a portion of a given divisor. A reciprocal error term is looked up in a second lookup table stored in a second computer memory. The reciprocal error term corresponds to at least a portion of the divisor. A reciprocal of the divisor is generated from the estimated reciprocal term and the error term. A dividend is multiplied by the reciprocal of the divisor to generate a quotient.
An apparatus for computing a reciprocal of an operand includes a first memory containing estimated reciprocal terms, and a second memory containing reciprocal error terms. The apparatus further includes an adder for adding a selected estimated reciprocal term from the first memory and a selected reciprocal error term from the second memory to provide the reciprocal, wherein the selected estimated reciprocal term and the selected reciprocal error term correspond to at least a portion of the operand.
An apparatus for performing a divide operation includes a first memory containing estimated reciprocal terms, and a second memory containing reciprocal error terms. The apparatus also includes an adder for adding a selected estimated reciprocal term from the first memory and a selected reciprocal error term from the second memory to provide the reciprocal. The selected estimated reciprocal term and the selected reciprocal error term correspond to at least a portion of a divisor. A multiplier multiplies a dividend by the reciprocal to generate a quotient.
Other objects, features, and advantages of the present invention will be apparent from the accompanying drawings and from the detailed description that follows below.